/* This source file is part of the Delectable Engine.
 * For the latest info, please visit http://delectable.googlecode.com/
 *
 * Copyright (c) 2009-2010 Ryan Chew
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file GameWindowEvents.h
 * @brief Delectable event defines.
 */

#ifndef __DBL_GAMEWINDOWEVENTS_H_
#define __DBL_GAMEWINDOWEVENTS_H_

// Chewable Headers //
#include <cbl/Chewable.h>
#include <cbl/Core/Event.h>

// Delectable Headers //
#include "dbl/Delectable.h"
#include "dbl/Input/KeyCodes.h"
#include "dbl/Input/MouseButtons.h"

namespace dbl
{
	namespace E
	{
		/*************************
		 *	[DEFINED EVENTS]
		 *
		 *	OnWindowResized
		 *	OnWindowCreated
		 *	OnWindowDestroyed
		 *	OnWindowClosed
		 *	OnWindowLostFocus
		 *	OnWindowGainedFocus
		 *
		 *	OnWindowKeyUp
		 *	OnWindowKeyDown
		 *	OnWindowKeyChar
		 *
		 *	OnWindowMouseWheel
		 *	OnWindowMouseMove
		 *	OnWindowMouseDown
		 *	OnWindowMouseUp
		 *	OnWindowMouseEnter
		 *	OnWindowMouseLeave
		 *************************/

		/***** Window Events *****/
		BEGIN_EVENT_DEF( OnWindowResized )
			/***** Event Arguments *****/
			cbl::Uint32	Width;
			cbl::Uint32	Height;

			/***** Event Constructors *****/
			// OnWindowResized constructor.
			Constructor()
				: Width( 0 ), Height( 0 ) {}
			// OnWindowResized constructor.
			Constructor( cbl::Uint32 width, cbl::Uint32 height )
				: Width( width ), Height( height ) {}
		END_EVENT_DEF

		// Window created event.
		BEGIN_EVENT_DEF( OnWindowCreated )
		END_EVENT_DEF

		// Window destroyed event.
		BEGIN_EVENT_DEF( OnWindowDestroyed )
		END_EVENT_DEF

		// Window calling close event.
		BEGIN_EVENT_DEF( OnWindowClosed )
		END_EVENT_DEF

		// Window lose focus event.
		BEGIN_EVENT_DEF( OnWindowLostFocus )
		END_EVENT_DEF

		// Window gained focus event.
		BEGIN_EVENT_DEF( OnWindowGainedFocus )
		END_EVENT_DEF
		
		// Window destroyed event.
		BEGIN_EVENT_DEF( OnWindowFullscreen )
			/***** Event Arguments *****/
			bool Fullscreen;
			bool Error;

			/***** Event Constructors *****/
			// OnWindowFullscreenToggle constructor.
			Constructor()
				: Fullscreen( false ), Error( false ) {}
			// OnWindowFullscreenToggle constructor.
			Constructor( bool fullscreen, bool error )
				: Fullscreen( fullscreen ), Error( error ) {}
		END_EVENT_DEF

		/***** Keyboard Events *****/

		// Window key down event.
		BEGIN_EVENT_DEF( OnWindowKeyDown )
			/***** Event Arguments *****/
			Key::Code		KeyCode;

			/***** Event Constructors *****/
			// OnWindowKeyDown constructor.
			Constructor()
				: KeyCode( Key::Code( 0 ) ) {}
			// OnWindowKeyDown constructor.
			Constructor( Key::Code code )
				: KeyCode( code ) {}
		END_EVENT_DEF

		// Window key up event.
		BEGIN_EVENT_DEF( OnWindowKeyUp )
			/***** Event Arguments *****/
			Key::Code		KeyCode;

			/***** Event Constructors *****/
			// OnWindowKeyUp constructor.
			Constructor()
				: KeyCode( Key::Code( 0 ) ) {}
			// OnWindowKeyUp constructor.
			Constructor( Key::Code code )
				: KeyCode( code ) {}
		END_EVENT_DEF
			
		// Window key character event.
		BEGIN_EVENT_DEF( OnWindowKeyChar )
			/***** Event Arguments *****/
			cbl::Uint32	Unicode;

			/***** Event Constructors *****/
			// OnWindowKeyChar constructor.
			Constructor( cbl::Uint32 code = 0 )
				: Unicode( code ) {}
		END_EVENT_DEF

		/***** Mouse events *****/
		
		// Window mouse wheel event.
		BEGIN_EVENT_DEF( OnWindowMouseWheel )
			/***** Event Arguments *****/
			cbl::Int16		Delta;

			/***** Event Constructors *****/
			// OnWindowMouseWheel constructor.
			Constructor( cbl::Int16 delta = 0 )
				: Delta( delta ) {}
		END_EVENT_DEF

		// Window mouse move event.
		BEGIN_EVENT_DEF( OnWindowMouseMove )
			/***** Event Arguments *****/
			cbl::Int32		X;
			cbl::Int32		Y;

			/***** Event Constructors *****/
			// OnWindowMouseMove constructor.
			Constructor()
				: X( 0 ), Y( 0 ) {}
			// OnWindowMouseMove constructor.
			Constructor( cbl::Int32 x, cbl::Int32 y )
				: X( x ), Y( y ) {}
		END_EVENT_DEF

		// Window mouse down event.
		BEGIN_EVENT_DEF( OnWindowMouseDown )
			/***** Event Arguments *****/
			Mouse::Button		Button;
			cbl::Int32		X;
			cbl::Int32		Y;

			/***** Event Constructors *****/
			// OnWindowMouseDown constructor.
			Constructor()
				: Button( Mouse::Button( 0 ) ), X( 0 ), Y( 0 ) {}
			// OnWindowMouseDown constructor.
			Constructor( Mouse::Button button, cbl::Int32 x, cbl::Int32 y )
				: Button( button ), X( x ), Y( y ) {}
		END_EVENT_DEF
		
		// Window mouse up event.
		BEGIN_EVENT_DEF( OnWindowMouseUp )
			/***** Event Arguments *****/
			Mouse::Button		Button;
			cbl::Int32		X;
			cbl::Int32		Y;

			/***** Event Constructors *****/
			// OnWindowMouseDown constructor.
			Constructor()
				: Button( Mouse::Button( 0 ) ), X( 0 ), Y( 0 ) {}
			// OnWindowMouseDown constructor.
			Constructor( Mouse::Button button, cbl::Int32 x, cbl::Int32 y )
				: Button( button ), X( x ), Y( y ) {}
		END_EVENT_DEF

		// Mouse has entered over window event.
		BEGIN_EVENT_DEF( OnWindowMouseEnter )
		END_EVENT_DEF
		
		// Mouse has left window event.
		BEGIN_EVENT_DEF( OnWindowMouseLeave )
		END_EVENT_DEF
	}
}

#endif // __DBL_GAMEWINDOWEVENTS_H_
